#pragma once

#include "Part.h"
#include "Common/ComTypeDefine.h"
#include "Common/HuoYueDuDefine.h"

class HuoYueDuPart : public Part
{
public:
	typedef std::map<uint32_t, CHuoYueDuInfo>					HuoYueDuMap;

public:
	HuoYueDuPart();
	virtual ~HuoYueDuPart();
public:
	virtual bool		Init(Creature *pMaster, uint32_t partType, CharacterDBInfo* pCharacterDB = nullptr);
	virtual bool		UnInit();
	virtual bool		OnMsgHandle(uint32_t cmd, const char* data, uint32_t len);
	virtual void		OnExecute(uint16_t nEventID, uint64_t nSrcID, uint8_t bySrcType, void *pContext, int32_t nLen){}
	virtual void		OnTimer(uint32_t nTimerID){}

	virtual bool		SaveDB(CharacterDBInfo& characterDB);

	virtual void		Update(uint64_t tick){}

	virtual bool		DailyUpdate(uint64_t unixSec);
	virtual bool		WeekUpdate(uint64_t unixSec);

	void				InitHuoYueDuData();

public:
	void				AddHuoYueDuRecord(uint32_t type);
	void				SendHuoYueDuInfo();
	//uint32_t			CalculateHuoYueDu();

	bool				HandleHuoYueDuInfo(const char* data, uint32_t len);
	bool				HandleHuoYueDuReward(const char* data, uint32_t len);

private:
	HuoYueDuMap			m_HuoYueDuRecord;
};
